#pragma once

#include "sys/IInterface.h"
#include "WorkspaceID.h"
#include "WsEvent.h"

interface IDocument;enum documentCategory;enum pageTypesetCategory; enum pageBindingCategory;

interface IWorkspace : public IInterface
{
	DEFINE_IID(IID_Workspace)

	event_declare(DocumentEventHandler,DocumentCreating);
	event_declare(DocumentEventHandler,DocumentCreated);
	event_declare(DocumentOpenEventHandler,DocumentOpening);
	event_declare(DocumentEventHandler,DocumentOpened);
	event_declare(DocumentCloseEventHandler,DocumentClosed);
	event_declare(DocumentCloseEventHandler,DocumentClosing);

	virtual vresult Create(const String& workpath) = 0;
	virtual void Close() = 0;

	virtual IDocument* NewDocument(documentCategory category,
																 pageTypesetCategory pageTypeset,
																 pageBindingCategory pageBinding,
																 uint32 pageCount,
																 real pageHeight,
																 real pageWidth,
																 real pageLeftMargin,
																 real pageTopMargin,
																 real pageRightMargin,
																 real pageBottonMargin) = 0;
	virtual IDocument* OpenDocument(const String& documentName) = 0;
	virtual vresult CloseDocument(const String& documentName) = 0;
	virtual IDocument* FindDocument(const String& documentName) const = 0;
	virtual IDocument* GetDocument(uint32 index) const = 0;
	virtual uint32 GetDocumentsCount() const = 0;
};